/**
 * Created by XPL on 2017/4/20.
 */

angular.module('app').directive('appPositionInfo', [function () {
    return {
        restrict: 'A',
        replace: true,
        transclude: true,
        scope: {
            isActive: '=',
            isLogin: '=',
            positionInfo: '='

        },
        link: function (scope) {
            scope.imgPath = scope.isActive?"images/star-active.png":"images/star.png";
            scope.$on('getState',function(isActive){
                scope.isActive = isActive;
                scope.imgPath = scope.isActive?"images/star-active.png":"images/star.png";
            });
            scope.collectfn = function(e){
                scope.isActive = !scope.isActive;
                scope.imgPath = scope.isActive?"images/star-active.png":"images/star.png";
            }
        },
        templateUrl: 'view/template/position-info.html'
    };
}])